$(function(){
	var dataTable = $("#bpWageCurveDataTable").DataTable({
		"ajax": {
			"url": '/bpWageCurve/list',
			"data": function(data){
				data.wageTime = $("#wageTime").val();
				data.event = $("#event").val();
				data.amplitude = $("#amplitude").val();
			}
		},
		"ordering": false,
		"columns": [
//			{
//				"data": "id",
//				"className": "text-center sign-col",
//				"render": function(data, type, row, meta){
//					return '<input type="checkbox" name="pk" value="' + data + '" onclick="checkOne()"/>';
//				}
//			},
//			{"data": "userId"},
//			{
//				"data": function(obj){
//					return new Date(obj.wageTime).Format("yyyy-MM-dd");
//				} 
//			},
			{"data": "wageTime"},
			{"data": "event"},
			{"data": "money"},
			{"data": "amplitude"},
			{"data": "position"},
			{
				"data": function(obj){
					return new Date(obj.createTime).Format("yyyy-MM-dd");
				} 
			},
			{"data": "remark"},
			{
				"data": "id",
				"className": "operate-col",
				"render": function(data, type, row, meta){
//					'<button type="button" onclick="edit(\''+ data +'\')" class="btn btn-sm btn-warning right-5"><i class="fa fa-edit"></i></button>'
					var html =  '<button type="button" onclick="view(\''+ data +'\')" class="btn btn-sm btn-info"><i class="fa fa-search"></i></button>';
					return html;
				}
			}
		]
	});
	
	$('#searchBtn').click(function(){
		dataTable.ajax.reload();
	});
	
	$('#resetBtn').click(function(){
		$('#bpWageCurveSearchForm')[0].reset();
		dataTable.ajax.reload();
	});
	
	$('#addBtn').click(function(){
		forwardPage('/bpWageCurve/bpWageCurve');
	});
	
//	$('#delBtn').click(function(){
//		ajaxBySelecteRows(dataTable,'/bpWageCurve/delete','确定要删除？');
//	});
	
	// 日期
	$('.datepicker').datetimepicker({
		language: 'zh-CN',
		format: 'yyyy-mm-dd',
		autoclose: true,
		todayBtn: true,
		clearBtn:true,
		minView: 2
	});
});

function edit(id){
	forwardPage('/bpWageCurve/bpWageCurve?id='+id);
}

function view(id){
	forwardPage('/bpWageCurve/view?id='+id);
}